package dd.tools;

/**
 * s.hasNext() ? "..." :"." == if(s.hasNext) syso("..."); else syso(".");
 */
/**
 * String s = String.format("%.2f", price) ;
 * System.out.printf("%.2f", price);
 */

public class BasisUmrechner {

	static int zahl = 123;
	static int base = 16;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("Decimal Converter\nInput(DEC): "+zahl);

		int rest = 0;
		String rest_str = "";
		String result = "";
		do {
			System.out.println(zahl+"\t: "+base+"\t= "+(zahl/base)+ "\t| Rest "+ (zahl%base));
			rest = zahl % base;
			rest_str = rest + "";
			zahl = zahl/base;
			if (base == 16){
				switch (rest){
					case 10: {	rest_str = "A";
								break;}
					case 11: {	rest_str = "B";
								break;}
					case 12: {	rest_str = "C";
								break;}
					case 13: {	rest_str = "D";
								break;}
					case 14: {	rest_str = "E";
								break;}
					case 15: {	rest_str = "F";
								break;}
				}
			}
			result = rest_str + result;
		} while (zahl != 0);
		System.out.println("Result: "+result);
	}

}
